#!/bin/bash

getopts :l opt

# ls_list=`ls|grep -P '\.o\d\d\d\d+$'`

ls_list=$(ls *.o[0-9][0-9][0-9]* 2> /dev/null)

if test "$opt" = "l" -a -n "$ls_list"; then
	ls --color=auto -lthr $ls_list
else
	if test -n "$ls_list"; then
		echo remove $ls_list &&  rm $ls_list
	fi
fi
